package cate.game.role.pvp.throne.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTB;
import cate.game.pvp.throne.data.ko.TBKoCurBet;
import cate.game.pvp.throne.data.ko.TBKoMatch;
import cate.game.pvp.throne.dto.TBGroupDataDTO;

@ClientMsg(title = "当前竞猜场次 の 请求")
public class TBKoCurBetReq implements MsgInput {


    @Override
    public void execute(GameBody game, ClientContext cc) {
        TBKoCurBet curBet = game.pvp.throne.data.holder.koBase.bet.cur;
        TBKoCurBetResp resp = new TBKoCurBetResp(curBet);
        if (curBet != null) {
            TBGroupDataDTO groupData = game.pvp.throne.data.holder.getGroup(resp.cur.levelGroup);
            if (groupData != null) {
                TBKoMatch match = groupData.ko.findBetMatch(curBet);
                if (match != null) {
                    resp.replayInfos = match.replayInfos;
                }
            }
        }
        resp.sendNow(cc.getRole());
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTB.CUR_BET_REQ;
    }
}
